package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by Administrater on 2015/12/31.
 */
public class DeleteAddressTask extends CouponHttpBaseTask {
    private String muserId;

    public DeleteAddressTask(String addressId) {
        super();
        muserId = addressId;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, response.getBody());
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest();
            JSONObject json = new JSONObject();
            json.put("addressId", muserId);
            request.setData(json.toString());
            request.setApiNo(ApiNo.DELETEADDRESS);
            addRequest(request);
        }
    }

}
